package StudyCode.summary.textfile;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.attribute.PosixFilePermission;
import java.util.Set;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class GetPOSIXFilePermission {
	public static void main(String[] args) throws Exception {
		Path path = Paths.get("home/docs/test.txt");
		try {
			Set<PosixFilePermission> permissions = Files.getPosixFilePermissions(path);
			System.out.print("权限: ");
			for (PosixFilePermission permission : permissions) {
				System.out.print(permission.name() + " ");
			}
			System.out.println();

		} catch (IOException ex) {
			ex.printStackTrace();
		}
	}
}
